package com.tencent.controller;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @BelongsProject: health2.2
 * @BelongsPackage: com.tencent.controller
 * @ClassName: IndexController
 * @Description: TODO
 * @Version: 1.0.0
 * @CreateTime: 2022-09-02  11:39
 * @Author: Yangjx
 */
@RestController
@RequestMapping("/myIndex")
public class IndexController {


    private Integer id;
    @GetMapping("/id")
    public String index(Integer id){
        this.id = id;
        return "ok";
    }

    @GetMapping("/getId")
    public Integer getId(){
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        Object o = authentication.getPrincipal();
//        System.out.println("o = " + o);
        return 1;
    }
}
